﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016091400512859";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCei2FcSFO0Z6ktTIzuIsCfDZQTwbmmG9AbYWOrGRg0mQWy0+RDiEWx4yUX62YedY2StY907uyUtP5LFuTVw+C8QsVCYQ9oeYi880UQuCRigytuENg/zh1gygYpVXudA0OFZzL3QJWhqmHwJ2rZ1t69UkxMGCE5D1F+yHB5UPphgwb6/6QZtSXuMdHL8Xq84Go6mgP+120cZpOhz1ry3Hk/liERmssU6pBwSvvXuVusj06SiNz7GwPTR6ohFPR0mMwwGnfRTclkKBwndZ6oZLx07gei7rlLMnVQBwMfAppXyCjWbhj4W1eG6lYCNiD+dgC8pRa2QLLWSMsxn3KXPBUrAgMBAAECggEAR3Ht7OUW+1wfS6+Mbp+wh7xZt1F8dJNiA4SuomLLmqA+hiigW6JkLdZ7V70XprA4nR0+SWaFrDmnwnTNqFr9wjigpdoRVHY4HVXPEMq6cr5DavUiThZ2/K/teODxtH7NBafMuska5OBgBBXvO71tYIleoofZKNpzUhvHO5Q3UItAK46ItH/u4hAW5h9VFvxcqITq1WfANfOG3LP8lybdtn/dSO+MqsuB66ak4c3suGRjvzUMjl5R0UIledXvsRMdrM9w86J03wxqRBOg5fP0IlIPpRGupjtlks46fkhjeAgDfc3CwXZ8Vi+V6d4j5LUX8snmyNC+1M4PzTRpHXkKQQKBgQDtXpWvtdFeK0uB1gdROLzmDwKxc0Hnfqp11BRaKLdbLyBU/ojXSkfkx3vjnVHVnQ+waEriQ0m8xcf0LNsupFz6BSUC8ugDNWP2+xmUqhtnqBQnmjl/kuzNiku0Btvbv48mu4X5XaroDNdbp0I+lzHmdYT6iXtmbwsyNJkJKkxfIQKBgQCq/Psg6P6Ci5Q5YvfbL9pttAHg4Byp4Mt6bA7HhGVpQiRD6kCvt3WvSAgRCctecZ0bKAHpCjFxFIU+UJCvU+x3Ete59n3m+Gnlqk92KxOhbOIKez0p6N2y0GL+eZnetPidpDW+MmzXj0KTFhUy2KNwczsbU+3pkBqQWjus8ZXmywKBgBD3DaO9TvV4CrGA5oz7jSS0NfEQ18j/2JcLTVkUR+aQe7MXbhhVCsZjK4udFtg5nYFyMsfxHzgKurvM6O1weeS0sWyAh+ySyE5CrBVgAw1piec6splXmu0l0TtQsi4GhuixxmWIOErVgB7g2W83xy09gP+XC+bKUPaJo9Zv232BAoGARMuEPrl/rQZ7nJs1Hfsi5wCFwPRqk+7d72OKjru2EaOK88hMPmaR8vQIStKmAFm13Dc8jYaMXfLjqS7BB8m8Wiw6n5eNEGDiOoVLcz/hphEo4Q60jSgkCs3NBpXmUrR9Uu++r8eaAyCgqI05+jsvhw7VuSkLj+1qwqmLWQnaRgECgYEA2dtf7tD5GaysGDa6eVaKrf1Q07cP6s0tihc50EcA+Of8v3L9JV8s5cpQB1nMMHS7Pf9K9SsTHzCoQG8/AOk9KbvS6M7rJDaGoUYGdincgNwnuInvTzeBGB9/1ZOZiLktIMAWfVgeZc+JDuNv4pBSxOLtf8svrh7V+O5yRcpNBwQ=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnothXEhTtGepLUyM7iLAnw2UE8G5phvQG2FjqxkYNJkFstPkQ4hFseMlF+tmHnWNkrWPdO7slLT+Sxbk1cPgvELFQmEPaHmIvPNFELgkYoMrbhDYP84dYMoGKVV7nQNDhWcy90CVoaph8Cdq2dbevVJMTBghOQ9RfshweVD6YYMG+v+kGbUl7jHRy/F6vOBqOpoD/tdtHGaToc9a8tx5P5YhEZrLFOqQcEr717lbrI9Okojc+xsD00eqIRT0dJjMMBp30U3JZCgcJ3WeqGS8dO4Hou65SzJ1UAcDHwKaV8go1m4Y+FtXhupWAjYg/nYAvKUWtkCy1kjLMZ9ylzwVKwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/bookstore01/client/paysuccess.do";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

